<?php
namespace app\api\controller;
use app\api\controller\BaseController;
use app\common\errcode\ApiErrCode;
use app\common\errcode\ApiErrMsg;
use think\Loader;

class DocmeeController extends BaseController
{
    protected $docmeeModel;

    public function __construct()
    {
        parent::__construct();
        $this->docmeeModel = new \app\api\model\DocmeeModel();
    }

    /**
     * 获取token
     * @param string $userid
     */
    public function token()
    {
        try {
            if($this->request->isPost()){
                $data = $this->request->post();
                return $this->jsonJump(ApiErrCode::SUCCESS,ApiErrMsg::SUCCESS,$this->docmeeModel->generate_token($this->userid));
            }            
        } catch (\Exception $e) {
            \app\common\model\CommonModel::recordLog($this->userid,'abnormal',date('Y-m-d H:i:s'),'warning',$e->getMessage());
            return $this->jsonJump(ApiErrCode::SYSTEM_ERROR,ApiErrMsg::SYSTEM_ERROR . ',错误信息:'. $e->getMessage());
        }        
    }   
}